<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="./js/vue.js"></script>
    <title>Document</title>
    <style>
        .static {
            width: 140px;
            height: 140px;
            margin: 20px;
            text-align: center;
            line-height: 140px;
            color: #fff;
            font-size: 30px;
        }

        .a {
            background: darkgoldenrod;
        }

        .b {
            border: 4px solid darkred;
        }

        .c {
            border-radius: 50%;
            box-shadow: 0 0 5px 0px #ccc;
        }
    </style>
</head>

<body>
    <div id="app">
        <h2>{{title}}</h2>
        <div class="static a b c">1</div>
        <div class="static " :class="active">2</div>
        <div class="static  " :class="{b:isv,a:active}">3</div>
        <div class="static c " :class="[classb,'a']">4</div>
        <hr>
        <h2>{{title2}}</h2>
        <div class="static " :style="style">S1</div>
        <div class="static " :style="{background:'red',borderRadius:'50%'}">S2</div>
        <div class="static " :style="[obj1,obj2]">S3</div>
        <hr>
        <h2 v-if=" seen==4">seen为真</h2>
        <h2 v-if=" seen==3">seen为假</h2>
        <button @click="seen-=1">点击切换</button>
        <button @click="seen+=1">点击切换</button>
    </div>
</body>
<script>
    const vm = new Vue({
        el: "#app",
        data: {
            title: "动态class 和style绑定",
            active: "a",
            isv: true,
            classb: "b",
            classc: "c",
            title2: "style绑定",
            seen: 4,
            style: {
                background: 'darkgoldenrod',
                border: '4px solid darkred',
                borderRadius: '50%',
                boxShadow: ' 0 0 5px 0px #ccc'

            },
            obj1: {
                background: 'darkgoldenrod',
                border: '4px solid darkred'
            },
            obj2: {
                boxShadow: ' 0 0 5px 0px #ccc'
            }
        },
        mounted() {
            document.querySelector("title").innerHTML = this.title
        }
    })
</script>

</html>